import Vue from 'vue'
import App from './App.vue'


//引入配置路由  use路由
import VueRouter from 'vue-router';
Vue.use(VueRouter);

//1、创建引入组件
import Start from './components/Start.vue';
import Hot from './components/Hot.vue';
import Search from './components/Search.vue';
import Order from './components/Order.vue';
import Home from './components/Home.vue';
import Cart from './components/Cart.vue';
import Pcontent from './components/Pcontent.vue';


//2、配置路由
const routes = [
  { path: '/start', component: Start },
  { path: '/home', component: Home },
  { path: '/search', component: Search },
  { path: '/hot', component: Hot },
  { path: '/cart', component: Cart },
  { path: '/order', component: Order },
  { path: '/pcontent', component: Pcontent },

  { path: '*', redirect: '/start' }
]

//3、实例化Vuerouter
const router = new VueRouter({
  routes // (缩写) 相当于 routes: routes
})

//4、挂载
new Vue({
  el: '#app',
  router,
  render: h => h(App)
})

//5、将<router-view></router-view>放到根组件